using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using WebapiTemplate.Domain.Entity;
using WebapiTemplate.Infrastructure.Persistence.DomainConfiguration.Base;

namespace WebapiTemplate.Infrastructure.Persistence.DomainConfiguration
{
    /// <summary>
    /// 设置表字段，并继承基础字段的设置类
    /// </summary

    public class FileInfoConfiguration : BaseEntityConfiguration<FileLog>
    {
        public override void Configure(EntityTypeBuilder<FileLog> builder)
        {
            base.Configure(builder);

            builder.ToTable("app_filelog");
            
            builder
                .Property(x => x.OriginalName)
                .HasColumnName("original_name")
                .HasMaxLength(2000)
                .HasColumnOrder(1); //using Microsoft.EntityFrameworkCore;
            builder
                .Property(x => x.Suffix)
                .HasColumnName("suffix")
                .HasMaxLength(2000)
                .HasColumnOrder(2);
            builder
                .Property(x => x.FileType)
                .HasColumnName("file_type")
                .HasMaxLength(2000)
                .HasColumnOrder(3);
            builder
                .Property(x => x.SaveDateTime)
                .HasColumnName("save_dateTime")
                .HasMaxLength(2000)
                .HasColumnOrder(4);
            builder
                .Property(x => x.SaveFileName)
                .HasColumnName("save_fileName")
                .HasMaxLength(2000)
                .HasColumnOrder(5);
            builder
                .Property(x => x.FileSize)
                .HasColumnName("file_size")
                .HasMaxLength(2000)
                .HasColumnOrder(6);
        }
    }
}
